/** Copyright 2014, Ross Mahony. Some rights reserved. See COPYING. */
package controllers

import play.api._
import play.api.mvc._
import play.api.db.slick._

import views._
import models._

/** [[play.api.mvc.Controller]] for the customers view. */
object Customers extends Controller {

 /**
  * Action to display the customers page.
  *
  * @param id Customer ID
  */
	def list(id: Option[Long]) = DBAction { implicit rs =>
    CustomerDAO.loadCustomer(id).map { customer =>
      Ok(html.customers.list(customer, CustomerDAO.list))
    }.getOrElse(NotFound)
  }

}
